import request from '@/utils/request'
import type { PageResult } from '@/types/process'
import type { TaskVo, ProcessTaskQuery } from '@/types/flow'

// 查询待办任务
export function getTaskTodoPage(params: ProcessTaskQuery) {
  return request<PageResult<TaskVo>>({
    url: '/workflow/task/todo/list',
    method: 'post',
    data: params,
  })
}

// 查询已办任务
export function getTaskDonePage(params: ProcessTaskQuery) {
  return request<PageResult<TaskVo>>({
    url: '/workflow/task/done/list',
    method: 'post',
    data: params,
  })
}

// 获取流程实例的审批记录
export function getTaskListByProcessInstanceId(id: string) {
  return request<TaskVo[]>({
    url: '/workflow/task/listByProcessInstanceId',
    method: 'post',
    params: { id },
  })
}
